import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        BigInteger n;
        BigInteger num;
        while(scanner.hasNextBigInteger()){
            BigInteger sum=BigInteger.valueOf(0);
            BigInteger mulSum=BigInteger.valueOf(1);
            n=scanner.nextBigInteger();
            if(n.compareTo(BigInteger.ZERO)==0){
                break;
            }
            for(BigInteger i=BigInteger.ONE;i.compareTo(n)<=0;i=i.add(BigInteger.ONE)){
                num=scanner.nextBigInteger();
                sum=sum.add(num);
                mulSum=mulSum.multiply(A(num));
            }
            System.out.println(A(sum).divide(mulSum));
        }
    }
    public static BigInteger A(BigInteger n){
        BigInteger ans=BigInteger.ONE;
        for(BigInteger i=BigInteger.ONE;i.compareTo(n)<=0;i=i.add(BigInteger.ONE)){
            ans=ans.multiply(i);
        }
        return ans;
    }
}
